import java.util.Scanner;

public class demo02 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String str=sc.nextLine();
        func(str);
    }
    public static void func(String str){
        String[] arr=str.split("/");
        if(arr[0].equals(arr[1])){//一个
            if(check(arr[0],arr[1],arr[2])){
                System.out.println("20"+arr[0]+"-"+arr[1]+"-"+arr[2]);
            }else if(check(arr[2],arr[1],arr[0])){
                System.out.println("20"+arr[2]+"-"+arr[1]+"-"+arr[0]);
            }
        }else if (arr[1].equals(arr[2])){//两个
            if(check(arr[0],arr[1],arr[2])) {
                System.out.println("20" + arr[0] + "-" + arr[1] + "-" + arr[2]);
            }
            if(check(arr[1],arr[2],arr[0])){
                System.out.println("20"+arr[1]+"-"+arr[2]+"-"+arr[0]);
            }
        }else{//三个
            if(check(arr[0],arr[1],arr[2])) {
                System.out.println("20" + arr[0] + "-" + arr[1] + "-" + arr[2]);
            }
            if(check(arr[2],arr[0],arr[1])) {
                System.out.println("20" + arr[2] + "-" + arr[0] + "-" + arr[1]);
            }
            if(check(arr[2],arr[1],arr[0])) {
                System.out.println("20" + arr[2] + "-" + arr[1] + "-" + arr[0]);
            }
        }
    }
    public static boolean check(String s1,String s2,String s3){
        int[] yue={0,31,28,31,30,31,30,31,31,30,31,30,31};
        int year=Integer.parseInt("20"+s1);
        int month=Integer.parseInt(s2);
        int day=Integer.parseInt(s3);
        if((year%4==0&&year%100!=0)||(year%400==0)){
            yue[2]+=1;
        }
        if(month>=1&&month<=12){
            if(day>=1&&day<=yue[month]){
                return true;
            }
        }
        return false;
    }
}
